package com.rightsidetech.system.dtos.request.adverts;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

@Data
public class BannerSaveReq implements Serializable {

    @ApiModelProperty(value = "主题",required = true)
    @NotBlank(message = "主题不可为空")
    @Pattern(regexp = "[\\u4e00-\\u9fa5a-zA-Z0-9]{0,30}+",message = "主题不支持特殊字符,最大长度为30")
    private String topicName;

    @ApiModelProperty(value = "banner类型 0-活动 1-公告 2-商品",required = true)
    @NotNull(message = "类型不可为空")
    @Range(min = 0,max = 2,message = "banner类型只有三种")
    private Byte bannerType;

    @ApiModelProperty(value = "图片",required = true)
    @NotBlank(message = "图片不可为空")
    @Pattern(regexp = "(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;*()]+[-A-Za-z0-9+&@#/%=~_|]",message = "图片应为一个url地址")
    private String picture;

    @ApiModelProperty(value = "发布平台 0-用户小程序 1-代理商app 2-门店app",required = true)
    @NotNull(message = "发布平台不可为空")
    @Range(min = 0,max = 2,message = "发布平台只有三种")
    private Byte platform;

    @ApiModelProperty("跳转id")
    @Min(value = 0,message = "id不可为负数")
    private Long jumpId;

    @ApiModelProperty(value = "发布开始时间 yyyy-MM-dd",required = true)
    @NotNull(message = "发布开始时间不可为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date startDate;

    @ApiModelProperty(value = "发布结束时间 yyyy-MM-dd",required = true)
    @NotNull(message = "发布结束时间不可为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endDate;}
